import request from '@/utils/request'

export function getGroup(page, query) {
	return request({
		url: `/api/sms/group/list`,
		method: "POST",
		data: query,
		params: page
	})
}


export function createGroup(query) {
	return request({
		url: `/api/sms/group/create`,
		method: "POST",
		data: query
	})
}

export function updateGroup(id, query) {
	return request({
		url: `/api/sms/group/update/${id}`,
		method: "POST",
		data: query
	})
}

export function getGroupInfo(id) {
	return request({
		url: `/api/sms/group/${id}`,
		method: "GET"
	})
}

export function updatePublish(id, status) {
	let query = new FormData();
	let ids = id.toString();
	query.append("ids", ids);
	query.append("publishStatus", status);
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: "/api/sms/group/update/publishStatus",
		method: "POST",
		data: query
	})
}

export function updateDelete(id) {
	let query = {
		id: id,
		deleteStatus: "1"
	}
	return request({
		headers: {
			"Content-Type": "multipart/form-data"
		},
		url: "/api/sms/group/update/deleteStatus",
		method: "POST",
		// data: query
		params: query
	})
}

export function getFormList(msg) {
	let query = new FormData();
	query.append("status", msg.status);
	// query.append("publishStatus", msg.publishStatus);
	if (msg.productName != null) {
		query.append("productName", msg.productName);
	}
	return request({
		headers: {
			"content-type": "multipart/form-data"
		},
		url: "/api/sms/group/formList",
		method: "POST",
		data: query
	})
}

export function getMemberList(id) {
	let query = new FormData();
	query.append("groupFormId", id)
	return request({
		headers: {
			"content-type": "multipart/form-data"
		},
		url: "/api/sms/group/memberList",
		method: "POST",
		data: query
	})
}

export function getConfig() {
	return request({
		url: "/api/sms/group/configure",
		method: "GET"
	})
}

export function updateConfig(query) {
	return request({
		url: "/api/sms/group/configure/update",
		method: "POST",
		data: query
	})
}

export function groupOrederList(msg) {
	return request({
		url: `/api/order/group/order/list`,
		method: "POST",
		data: msg
	})
}
